home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / graphics / amicad / arexx / typeanalyse.amicad < prev    next >
Text File  |  1999-12-06  |  5KB  |  173 lines

  1. /* Choix du type d'analyse Spice */
  2. /* Version 2.00 (Ajout analyse du point de fonctionnement .OP) */
  3. /* $VER: 2.00 (4/10/99) */
  4.  
  5. options results     /* indispensable pour récupérer le résultat des macros */
  6.  
  7. signal on error     /* pour l'interception des erreurs */
  8. signal on syntax
  9.  
  10. 'TITLE("Recherche analyse existante..."):OBJECTS(-1)'
  11. objets=result
  12. objet_analyse=0
  13. analyse=''
  14. do i=1 to objets
  15.     'FINDOBJ('i',4,-1,-1)'; i=result
  16.     if i>0 then do
  17.     'READTEXT('i')'; t=result
  18.     if left(t,10)=".ANALYSE: " then do
  19.         analyse=substr(t,10)
  20.         objet_analyse=i
  21.         leave
  22.     end
  23.     end
  24.     else leave
  25. end
  26. if analyse~='' then do
  27.     if substr(analyse,1,3)="OP" then do
  28.     'REQUEST("L''analyse actuelle"+CHR(10)+"détermine le point"+CHR(10)+"de fonctionnement"+CHR(10)+"du montage"+CHR(10)+"Voulez-vous en changer?")'
  29.     if result=1 then analyse=''
  30.     else analyse='OP'
  31.     end
  32.     else if substr(analyse,1,3)="AC" then do
  33.     'REQUEST("Le type d''analyse actuel"+CHR(10)+"est le type AC"+CHR(10)+"Voulez-vous en changer?")'
  34.     if result=1 then analyse=''
  35.     else do
  36.         analyse=edition_analyse_AC(analyse)
  37.         if analyse='' then exit
  38.     end
  39.     end
  40.     else if substr(analyse,1,3)="DC" then do
  41.     'REQUEST("Le type d''analyse actuel"+CHR(10)+"est le type DC"+CHR(10)+"Voulez-vous en changer?")'
  42.     if result=1 then analyse=''
  43.     else do
  44.         analyse=edition_analyse_DC(analyse)
  45.         if analyse='' then exit
  46.     end
  47.     end
  48.     else if upper(substr(analyse,1,5))="TRAN" then do
  49.     'REQUEST("Le type d''analyse actuel"+CHR(10)+"est le type TRAN"+CHR(10)+"Voulez-vous en changer?")'
  50.     if result=1 then analyse=''
  51.     else do
  52.         analyse=edition_analyse_TRAN(analyse)
  53.         if analyse='' then exit
  54.     end
  55.     end
  56.     else do
  57.     'MESSAGE("Type d''analyse inconnu")'
  58.     exit
  59.     end
  60.     if analyse~="" then  'SAVEALL(-1):SETTEXT('objet_analyse',".ANALYSE: 'analyse'")'
  61. end
  62. if analyse='' then do
  63.     'SELECT("Type d''analyse à effectuer"+CHR(10)+"Point de fonctionnement"+CHR(10)+"AC"+CHR(10)+"DC"+CHR(10)+"Transient")'
  64.     select
  65.     when result=1 then do
  66.         analyse="OP"
  67.     end
  68.     when result=2 then do
  69.         analyse=edition_analyse_AC("AC DEC/OCT/LIN 100 10 1000")
  70.     end
  71.     when result=3 then do
  72.         analyse=edition_analyse_DC("DC V 1V 10V 0.01V")
  73.     end
  74.     when result=4 then do
  75.         analyse=edition_analyse_TRAN("TRAN 0.01s 1s 0s")
  76.     end
  77.     otherwise
  78.         exit
  79.     end
  80.     if analyse='' then exit
  81.     if objet_analyse>0 then 'SAVEALL(-1):SETTEXT('objet_analyse',".ANALYSE: 'analyse'")'
  82.     else 'WRITE(".ANALYSE: 'analyse'",0,0):TITLE("Placez ce texte sur le document")'
  83. end
  84.  
  85. exit
  86.  
  87. edition_analyse_AC:
  88.     parse arg type variation nbre_pts freq_debut freq_fin
  89.     if type="AC" then do
  90.     'SELECT("Type de variation ('variation')"+CHR(10)+"Décade (DEC)"+CHR(10)+"Octave (OCT)"+CHR(10)+"Linéaire (LIN)")'
  91.     select
  92.         when result=1 then do
  93.         f="DEC "; v="par décade"
  94.         end
  95.         when result=2 then do
  96.         f="OCT "; v="par octave"
  97.         end
  98.         when result=3 then do
  99.         f="LIN "; v="de test"
  100.         end
  101.         otherwise do
  102.         return ''
  103.         end
  104.     end
  105.     'ASKNUM("Nombre de points 'v'?",'nbre_pts')'
  106.     if result='' then return ""
  107.     else f=f||result
  108.     'ASKTEXT("Quelle est la fréquence de début?","'freq_debut'")'
  109.     if result='' then return ""
  110.     else f=f||" "||result
  111.     freq_fin=strip(freq_fin)
  112.     'ASKTEXT("Quelle est la fréquence de fin?","'freq_fin'")'
  113.     if result='' then return ""
  114.     else analyse="AC "||f||' '||result
  115.     'MESSAGE("Attention: pour ce type"+CHR(10)+"d''analyse il faut utiliser"+CHR(10)+"un générateur de signal"+CHR(10)+"de valeur AC x")'
  116.     return analyse
  117.     end
  118.     return ''
  119.  
  120. edition_analyse_DC:
  121.     parse arg type source vmin vmax pas
  122.     if type='DC' then do
  123.     'UNMARK(-1):MESSAGE("Vous devez maintenant"+CHR(10)+"sélectionner une source")'
  124.     'PICKOBJ("Sélectionnez le générateur à faire varier.")'
  125.     f=result
  126.     if f<1 then return ''
  127.     'MARK('f'):TYPE('f')'
  128.     if result=5 then 'READTEXT('f')'
  129.     else 'READTEXT(GETREF('f'))'
  130.     f=result
  131.     'V0=ASKTEXT("Quelle est la valeur de départ?","'vmin'")'
  132.     if result='' then return ''
  133.     else f=f||' '||result
  134.     'V1=ASKTEXT("Quelle est la valeur finale.","'vmax'")'
  135.     if result='' then return ''
  136.     else f=f||' '||result
  137.     pas=strip(pas)
  138.     'ASKTEXT("Quel est l''incrément?","'pas'")'
  139.     if result='' then return ''
  140.     else analyse="DC "||f||' '||result
  141.     return analyse
  142.     end
  143.     return ''
  144.  
  145. edition_analyse_TRAN:
  146.     parse arg type pas tmax tdebut
  147.     if upper(type)='TRAN' then do
  148.     'ASKTEXT("Temps de simulation?","'tmax'")'
  149.     tmax=strip(result)
  150.     if tmax='' then return ''
  151.     pas=strip(pas)
  152.     'ASKTEXT("Pas de simulation?","'pas'")'
  153.     pas=strip(result)
  154.     if pas='' then return ''
  155.     tdebut=strip(tdebut)
  156.     'ASKTEXT("Temps de début de la simulation?","'tdebut'")'
  157.     tdebut=strip(result)
  158.     if tdebut='' then return ''
  159.     analyse="tran "||pas||" "||tmax||" "||tdebut
  160.     return analyse
  161.     end
  162.     return ''
  163.  
  164. /* Traitement des erreurs, interruption du programme */
  165. syntax:
  166. erreur=RC
  167. 'MESSAGE("Erreur de syntaxe"+CHR(10)+"en ligne 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  168. exit
  169.  
  170. error:
  171. 'MESSAGE("Erreur en ligne 'SIGL'")'
  172. exit
  173.